import QtQuick 2.0
import QtQuick.Controls 1.4
import QtQuick.Dialogs 1.3

BaseRect{
    color: Qt.rgba(89/255, 89/255, 89/255, 1)
    radius: 5

    property string labelTxt: ""
    property var value
    property alias tf: tf
    signal setValue(var v)

    Row {
        id: row
        spacing: 0
        width: l.width+b2.width+tf.width
        height: 22
        anchors.centerIn: parent

        Label {
            id: l
            text: labelTxt
            color: "white"
            anchors.verticalCenter: parent.verticalCenter
        }

        TextField{
            id: tf
            width: 50
            anchors.verticalCenter: parent.verticalCenter
            text: value
            onTextChanged: {
                if(text && text !== undefined)
                {
                     setValue(text)
                }
            }
        }

        Button{
            id: b2
            text: "选色盘"
            anchors.verticalCenter: parent.verticalCenter
            onClicked: {
                 colorDialog.visible = true
            }
        }
    }

    ColorDialog{
        id: colorDialog
        visible: false
        onAccepted: {
            tf.text = colorDialog.color
        }
    }
}

